import { defineStore } from "pinia";

export const useFlowableStore = defineStore("process", {
  state: () => ({
    lastInstance: null as any | null, // 上次启动的流程实例
  }),

  actions: {
    setInstance(instance: any) {
      this.lastInstance = instance;
    },
    clearInstance() {
      this.lastInstance = null;
    },
  },

  persist: {
    key: "flowable:lastInstance", // 存储 key
    storage: localStorage,        // 或 sessionStorage
  },
});
